<template>
    <div :style="style.one">
        <span :style="style.left" v-text="Lang.from[lang][7]">支付方式:</span>
        <div :style="style.right">
			<!-- <hb-mult-select v-for="(vy, i) in list" :key="i" label="{{Lang.pay[lang][vy-1]}}" class="items" @select="multSelect" name="{{vy}}"  /> -->
            <hb-mult-select  :label="Lang.pay[lang][0]" class="items" @select="multSelect" name="1"  />
			<hb-mult-select  :label="Lang.pay[lang][1]" class="items" @select="multSelect" name="2" />
            <hb-mult-select :label="Lang.pay[lang][2]" class="items" @select="multSelect" name="3" /> 
           
        </div>
    </div>
</template>

<script>
import {vpost, vlink} from '@api'
import style from './style.jsx'
import Lang from './lang.js'
export default {
	name: 'formitems',
	data() {
		return {
			Lang,
			list: [],
			style,
			selected: [
				// 通过name回调, 可以获取哪个被选中了
				false, // 支付宝
				false,
				false,
			],
			sbox: [], // 向上传的数组
		}
	},
	created() {
		this.init()
	},
	computed: {
		lang() {
			return this.$store.state.setting.lang
		},
	},
	methods: {
		multSelect(state, name) {
			let index = Number(name)
			this.selected[index-1] = state
			// 获取数组, 哪些被选中了

			let re = []
			for (let i = 0; i < this.selected.length; i++) {
				let value = this.selected[i]
				if (value) {
					re.push(i + 1)
				}
			}

			this.sbox = re
			// 向上传递
			this.$emit('select', 'way', this.sbox)
		},
		init() {
			vpost(vlink.user.walletInf).then(re => {
				if (re != null && re.status == 1) {
					this.list = re.data.idList
				}
			})
		},
	},
}
</script>

<style scoped>
.test {
}
.items {
	margin-right: 20px;
}
</style>